package com.gss.stockLedger.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.poi.ss.usermodel.Workbook;

import com.gss.stockLedger.domain.FIFOReportDTO;
import com.gss.stockLedger.form.VendorWiseReportFilter;

public class GenerateVendorWiseExcelThread extends Thread {


	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy");
	SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("ddMMyyyyHHmmss");
	
	boolean running = true;
	boolean writing;
	final Workbook workbook;
	final VendorWiseReportFilter reportGenerateForm;
	final Date reportDate;
	Map<String, List<FIFOReportDTO>> partId_data_map;
	
	public GenerateVendorWiseExcelThread (Workbook workbook,VendorWiseReportFilter form, Date date){
		this.workbook = workbook;
		this.reportGenerateForm = form;
		this.reportDate = date;
		partId_data_map = new HashMap<String, List<FIFOReportDTO>>();
	}
	
	public boolean isRunning() {
		return running;
	}

	public boolean isWriting() {
		return writing;
	}

	public void setRunning(boolean running) {
		this.running = running;
	}

	public void setWriting(boolean writing) {
		this.writing = writing;
	}


	public Map<String, List<FIFOReportDTO>> getPartId_data_map() {
		return partId_data_map;
	}
	
	@Override
	public void run() {
		Integer excelRowCounter = 10;
		do{
			while(partId_data_map.size() > 0){
				String vendorCode =  partId_data_map.keySet().iterator().next();
				List<FIFOReportDTO> finalReportList = partId_data_map.get(vendorCode);
				
//				ExcelCreationService.appendVendorWiseSheet(excelRowCounter, workbook,fifoReportDTO,vendorWiseReportFilter,date);
				excelRowCounter++;
			}
		}while(running);
	}
}
